using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;using Maxleaf.EDI.Domain.K3;

namespace Maxleaf.EDI.DataAccess.K3
{
    public class t_DataObjectMap : EntityTypeConfiguration<t_DataObject>
    {
        public t_DataObjectMap()
        {
            // Primary Key
            this.HasKey(t => new { t.FType, t.FDataObjectID });

            // Properties
            this.Property(t => t.FType)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.FDataObjectID)
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.None);

            this.Property(t => t.FName)
                .IsRequired()
                .HasMaxLength(80);

            this.Property(t => t.FName_CHT)
                .IsRequired()
                .HasMaxLength(80);

            this.Property(t => t.FName_EN)
                .IsRequired()
                .HasMaxLength(80);

            this.Property(t => t.FDescription)
                .IsRequired()
                .HasMaxLength(255);

            this.Property(t => t.FDescription_CHT)
                .IsRequired()
                .HasMaxLength(255);

            this.Property(t => t.FDescription_EN)
                .IsRequired()
                .HasMaxLength(255);

            this.Property(t => t.FComponentName)
                .IsRequired()
                .HasMaxLength(255);

            // Table & Column Mappings
            this.ToTable("t_DataObject");
            this.Property(t => t.FType).HasColumnName("FType");
            this.Property(t => t.FDataObjectID).HasColumnName("FDataObjectID");
            this.Property(t => t.FName).HasColumnName("FName");
            this.Property(t => t.FName_CHT).HasColumnName("FName_CHT");
            this.Property(t => t.FName_EN).HasColumnName("FName_EN");
            this.Property(t => t.FDescription).HasColumnName("FDescription");
            this.Property(t => t.FDescription_CHT).HasColumnName("FDescription_CHT");
            this.Property(t => t.FDescription_EN).HasColumnName("FDescription_EN");
            this.Property(t => t.FDataModel).HasColumnName("FDataModel");
            this.Property(t => t.FObjectType).HasColumnName("FObjectType");
            this.Property(t => t.FObjectID).HasColumnName("FObjectID");
            this.Property(t => t.FSubSysID).HasColumnName("FSubSysID");
            this.Property(t => t.FComponentName).HasColumnName("FComponentName");
        }
    }
}
